{% extends '__base__.html' %}

{% block title %}协议分析配置列表{% endblock %}

{% block beforehead %}

<script>
function initVM(data) {
    $('#div-configs').show();

    var vm = new Vue({
        el: '#div-configs',
        data: {
            xyfx_configs: data.xyfx_configs
        },
        methods: {
            
            delete_config: function (config) {
                showConfirm('确认删除？', '确认要删除评论“' + config.name + '”？删除后不可恢复！', function () {
                    postApi('/api/configs/' + config.id + '/delete', {}, function (err, r) {
                        if (err) {
                            return showError(err);
                        }
                        location.reload();
                    });
                });
            }
        }
    });
}
$(function() {
    getApi('/api/xyfx/index', function (err, results) {
        if (err) {
            return showError(err);
        }
        initVM(results);
        $('#div-loading').hide();
       
    });

});

</script>

{% endblock %}

{% block content %}
    
    <div class="uk-width-1-1 uk-margin-bottom" >
        <div class="uk-panel uk-panel-box">
            <ul class="uk-breadcrumb">
            {% for m in menus %}
                {% if m.level == 2 and m.display == 1%}
                <li><a href="{{ m.url }}"><span>{{ m.name }}</span></a></li>
                {% endif %}
            {% endfor %}
            </ul>
        </div>
    </div>
    <div id="div-configs" class="uk-width-1-1" style="display:none">
        <table class="uk-table uk-table-hover">
            <thead>
                <tr>
                    <th class="uk-width-1-6">序号</th>
                    <th class="uk-width-1-6">名称</th>
                    <th class="uk-width-2-6">文件名</th>
                    <th class="uk-width-1-6">类型</th>
                    <th class="uk-width-1-6">操作</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="xc in xyfx_configs" >
                    <td>
                        <span v-text="xc.id"></span>
                    </td>
                    <td>
                        <span v-text="xc.name"></span>
                    </td>
                    <td>
                        <span v-text="xc.filename"></span>
                    </td>
                    <td>
                        <span v-text="xc.type"></span>
                    </td>
                    <td>
                        <a href="#0" v-on:click="delete_config(xc)"><i class="uk-icon-cog"></i>
                        <a href="#0" v-on:click="delete_config(xc)"><i class="uk-icon-trash-o"></i>
                    </td>
                </tr>
            </tbody>
        </table>
       
    </div>
    <div id="div-loading" class="uk-width-1-1 uk-text-center">
        <span><i class="uk-icon-spinner uk-icon-medium uk-icon-spin"></i> 正在加载...</span>
    </div>
{% endblock %}
